﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;

namespace Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.Tests.Integration.Instruments
{
    public static class ApplicationExtension
    {
        public static IEnumerable<TWindow> GetWindows<TWindow>(this Application extendee)
            where TWindow : Window
        {
            return extendee.Windows.OfType<TWindow>();
        }

        public static TWindow GetWindow<TWindow>(this Application extendee)
            where TWindow : Window
        {
            return extendee.GetWindows<TWindow>().First();
        }
    }
}
